package com.zhuoyue.biz.core.command.cmd.common.fab.base;

/**
 * 八路控制器子索引
 *
 * @author Administrator
 */
public enum IndexTypeWaysEnum {

    /**
     * 八路控制器非延时子索引
     *
     */
    WAY_1("1","00008000"),
    WAY_2("2","00020000"),
    WAY_3("3","00080000"),
    WAY_4("4","00200000"),
    WAY_5("5","00800000"),
    WAY_6("6","02000000"),
    WAY_7("7","08000000"),
    WAY_8("8","20000000"),

    /**
     * 八路控制器延时子索引
     *
     */

    DELAY_WAY_1("DELAY"+"1","00018000"),
    DELAY_WAY_2("DELAY"+"2","00060000"),
    DELAY_WAY_3("DELAY"+"3","00180000"),
    DELAY_WAY_4("DELAY"+"4","00600000"),
    DELAY_WAY_5("DELAY"+"5","01800000"),
    DELAY_WAY_6("DELAY"+"6","06000000"),
    DELAY_WAY_7("DELAY"+"7","18000000"),
    DELAY_WAY_8("DELAY"+"8","60000000");


    private String code;
    private String childOd;

    IndexTypeWaysEnum(String code, String childOd) {
        this.code = code;
        this.childOd = childOd;
    }

    public String getCode() {
        return code;
    }

    public String getChildOd() {
        return childOd;
    }


    /**
     * 根据Key得到枚举的Value
     * 普通for循环遍历，比较判断
     *
     * @param key
     * @return
     */
    public static String getEnumType(String key) {
        IndexTypeWaysEnum[] alarmGrades = IndexTypeWaysEnum.values();
        for (int i = 0; i < alarmGrades.length; i++) {
            if (alarmGrades[i].getCode().equals(key)) {
                return alarmGrades[i].getChildOd();
            }
        }
        return "";
    }

}
